/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package core.proxy;

import core.descriptors.TaskDescriptor;
import core.descriptors.WorkerDescriptor;
import core.interfaces.Discovery;
import core.util.COREServiceRegistry;
import core.worker.Address;
import org.apache.log4j.Logger;

/**
 *
 * @author Vincenzo Merlo, Scuderi Giovanni Luca, Paolo Giuffrida
 *
 * TODO: controllare attentamente!!! VEDERE WorkerDiscoveryProxyP2P
 */
public class WorkerDiscoveryProxy implements Discovery {

    private final Logger logger = COREServiceRegistry.getLogger(WorkerDiscoveryProxy.class.toString());

    /**
     *
     */
    public WorkerDiscoveryProxy() {
        logger.debug(" costructor");
    }

    /**
     *
     * @param td
     * @return
     */
    @Override
    public Address getWorker(TaskDescriptor td) {
        logger.debug("getWorker");
        return COREServiceRegistry.getDiscovery().getWorker(td);
    }

    /**
     *
     * @param index
     * @param wd
     * @return
     */
    @Override
    public int updateWorker(int index, WorkerDescriptor wd) {
        logger.debug("updateWorker");
        return COREServiceRegistry.getDiscovery().updateWorker(index, wd);
    }

    /**
     *
     * @param wd
     * @return
     */
    @Override
    public int addWorker(WorkerDescriptor wd) {
        logger.debug("addWorker");
        return COREServiceRegistry.getDiscovery().addWorker(wd);
    }
}
